<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>企业员工工资管理-个人信息</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="static/css/font.css">
    <link rel="stylesheet" href="static/css/xadmin.css">
    <link rel="stylesheet" href="static/lib/layui/css/layui.css">

</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a>首页</a>
        <a>个人信息</a>
        <a>
          <cite>信息详情</cite></a>
      </span><!---->
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="employee-info-container">
    <blockquote class="layui-elem-quote">个人信息</blockquote>
    <div class="my-flex-row">
        <div class="employee-info-container-left">
            <div class="employee-info-row">
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">工号</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eAccount" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>

                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">姓名</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">性别</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eSex" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
            </div>
            <div class="employee-info-row" style="margin-bottom: 0;">
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">部门</span>
                    <div class="layui-input-inline">
                        <input type="text" id="dName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>

                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">岗位</span>
                    <div class="layui-input-inline">
                        <input type="text" id="pName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">职称</span>
                    <div class="layui-input-inline">
                        <input type="text" id="rankName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
            </div>
            <!--            <div class="employee-info-row-item my-flex-row">-->
            <!--                <div class="employee-info-row-item-name">岗位职责</div>-->
            <!--                <div class="layui-input-inline" style="width: 100%">-->
            <!--                    <input type="text" id="jobResponsibility" class="layui-input  employee-info-row-item-input"-->
            <!--                           style="width: 100%" disabled-->
            <!--                           value=""/>-->
            <!--                </div>-->

            <!--            </div>-->
        </div>
        <div class="employee-info-img">
            <img src="" id="eHeadPath" height="150" width="110"/>
        </div>
    </div>
    <br>
    <blockquote class="layui-elem-quote">联系方式</blockquote>
    <div class="employee-info-modify">
        <form class="layui-form">
            <div class="my-flex-row">
                <div class="employee-info-container-left">
                    <div class="employee-info-row">
                        <div class="employee-info-row-item">
                            <span class="employee-info-row-item-name">手机号码</span>
                            <div class="layui-input-inline">
                                <input type="text" id="ePhone" class="layui-input  employee-info-row-item-input"
                                       value=""/>
                            </div>

                        </div>
                        <div class="employee-info-row-item">
                            <span class="employee-info-row-item-name">邮箱地址</span>
                            <div class="layui-input-inline">
                                <input type="text" id="eEmail" class="layui-input  employee-info-row-item-input" value=""/>
                            </div>
                        </div>
                        <div class="employee-info-modify-button">
                            <button class="layui-btn" lay-submit lay-filter="updateInfo"> 保存修改</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <blockquote class="layui-elem-quote">岗位职责</blockquote>
    <br>
    <div class="employee-info-row-job" id="jobResponsibility">

    </div>
</div>


</body>

<style>
    .employee-info-table {
        width: 100%;
    }

    .employee-info-input {
        width: 100%;
    }

    .employee-info-container {
        padding: 16px;
    }

    .employee-info-container-left:last-child {
        margin-bottom: 0;
    }

    .my-flex-row {
        display: flex;
        flex-direction: row;
        align-items: center;

        /*flex-grow: 0;*/
        /*flex-shrink: 0;*/
    }

    .employee-info-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: left;

        margin-bottom: 1.5rem;
    }

    .employee-info-row-item {
        margin-right: 5rem;
    }

    .employee-info-row-item-name {
        display: inline-block;
        margin-right: 1rem;
        min-width: 4rem;
    }

    .employee-info-row-item-input {
        width: 17rem;
    }

    .employee-info-modify {
        margin-top: 2rem;
    }

    .job-responsibility {
        line-height: 1.5rem;
        marigin:0 auto;
    }

    .employee-info-row-job {
        line-height: 1.5rem;
        margin-left:auto;
        margin-right:auto;
    }

</style>

<script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="static/lib/layui/layui.js"></script>
<script type="text/javascript" src="static/js/xadmin.js"></script>
<script>
    var dRemark = null;
    var pDuty = null;
    window.onload = function () {
        $.ajax({
            url: "inforEmployee.do",
            type: "get",
            dataType: "json",
            success: function (data) {
                var employee = data.employee;
                var rankBonus = data.rankBonus;
                var position = data.position;
                var department = data.department;
                let jobResponsibility = data.jobResponsibility;
                $("#eBasePay").val(employee.eBasePay);
                $("#eAccount").val(employee.eAccount);
                $("#eEmail").val(employee.eEmail);
                $("#eEntryTime").val(employee.eEntryTime)
                $("#eBirthday").val(employee.eBirthday)
                $("#eHometown").val(employee.eHometown)
                $("#eDagree").val(employee.eDagree)
                $("#eIdcard").val(employee.eIdcard)
                $("#eName").val(employee.eName)
                $("#ePhone").val(employee.ePhone)
                $("#dName").val(department.dName)
                $("#pName").val(position.pName)
                $("#rankName").val(rankBonus.rankName)
                $("#eSex").val(employee.eSex)
                $("#eUrgentPerson").val(employee.eUrgentPerson)
                $("#eUrgentPhone").val(employee.eUrgentPhone)
                $("#eHeadPath").attr('src', employee.eHeadPath)
                $("#jobResponsibility").html(jobResponsibility);
                dRemark = department.dRemark;
                pDuty = position.pDuty;
            },
        })
    }

    function getPosition() {
        //页面层
        layer.open({
            title: ['岗位描述',
                'background:#EFEFEF; color:#000;'],
            type: 1,
            // skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: dRemark
        });
    }

    function getDepartment() {
        //页面层
        layer.open({
            title: ['部门介绍',
                'background:#EFEFEF; color:#000;'],
            type: 1,
            // skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: pDuty
        });
    }

    // 预先加载
    layui.use('form', function () {
        // 注册变量
        var form = layui.form;

        //监听提交form里面的submit标签
        form.on('submit(updateInfo)', function (data) {
            $.ajax({
                url: "updateInforEmployee.do",
                data: {
                    "eEmail": $("#eEmail").val(),
                    "eUrgentPerson": $("#eUrgentPerson").val(),
                    "eUrgentPhone": $("#eUrgentPhone").val(),
                    "eHometown": $("#eHometown").val(),
                    "ePhone": $("#ePhone").val()
                },
                type: "post",
                dataType: "json",
                success: function (result) {
                    if (result.code == 100) {
                        layer.alert("个人信息修改成功", {title: "操作提示"})
                    } else {
                        layer.alert(result.message, {title: "操作提示"})
                    }
                },
            })
            return false;
        });
    });

</script>
</html>
